package com.sesame.util;


import com.sesame.config.ProjectConfig;
import kim.sesame.framework.web.context.SpringContextUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * 主题
 *
 * @author wangjianghai
 * @date 2016年3月31日 下午3:47:34
 * @Description:
 */
public class Theme {

    public static String resourcePath = null;

    public static List<String> themes = null;//所有的主题

    static{
        ProjectConfig config = SpringContextUtil.getApplicationContext().getBean(ProjectConfig.class);
        if (config.isLocalThemePath()) {
            resourcePath = Theme.class.getResource("../theme").getFile();
        } else {
            resourcePath = SpringContextUtil.getCurrentPath() + "/theme";
        }

        themes = new ArrayList<String>();
        File[] array = new File(resourcePath).listFiles();
        for (int i = 0; i < array.length; i++) {
            if (array[i].isDirectory()) {
                themes.add(array[i].getName());
            }
        }

    }

}
